package com.shay.dubbo.consumer;

import com.shay.dubbo.api.ShayService;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Consumer
 *
 * @author shay
 * @date 2016/8/4
 */
public class ShayAction {
    private ShayService shayService;

    public void setShayService(ShayService shayService) {
        this.shayService = shayService;
    }

    public void start() throws Exception {
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            try {
                String hello = shayService.sayHello("world " + i);
                System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + hello);
            } catch (Exception e) {
                e.printStackTrace();
            }
            Thread.sleep(2000);
        }
    }
}
